package com.zyx.mpdemo.common.exception.code;

import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;

/**
 * 枚举常用Response操作码
 */
@AllArgsConstructor
public enum ResultCode implements IErrorCode {

    SUCCESS(HttpStatus.OK.value(), "操作成功!"),
    FAILED(HttpStatus.INTERNAL_SERVER_ERROR.value(), "操作失败!"),

    AUTHENTICATION_FAILED(50001, "获取token失败!"),
    AUTH_SERVER_ERROR(50002, "授权服务异常!"),
    LOGIN_METHOD_IS_EMPTY(50003, "登录方式不能为空!"),
    LOGIN_METHOD_IS_INVALID(50004, "登录方式只支持password模式!"),

    UNAUTHORIZED(40001, "身份认证失败!"),
    VALIDATE_FAILED(40002, "Token参数校验失败,请检查Token是否正确!"),
    FORBIDDEN(40003, "无权限请求,请检测当前用户身份信息!"),
    ACCOUNT_IS_EMPTY(40004, "账号不能为空!"),
    PASSWORD_IS_EMPTY(40005, "密码不能为空!");

    /**
     * 消息码
     */
    private final Integer code;

    /**
     * 消息体
     */
    private final String message;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

}
